Skip to content

8380060: C2: Wrong execution with COH and arraycopy#30873

Open
rwestrel wants to merge 11 commits intoopenjdk:masterfrom
rwestrel:JDK-8380060
Open

8380060: C2: Wrong execution with COH and arraycopy#30873
rwestrel wants to merge 11 commits intoopenjdk:masterfrom
rwestrel:JDK-8380060

Conversation

@rwestrel
Copy link
Copy Markdown
Contributor

@rwestrel rwestrel commented Apr 22, 2026

This was discussed in:

#30775

get_alias_index() has the side effect of allocating a new alias so if we don't perform the call then code that iterates over all aliases until num_alias_types() to fix the memory graph during EA skips the newly added NarrowMemProjNode.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8380060: C2: Wrong execution with COH and arraycopy (Bug - P3)

Reviewers

Contributors

  • Christian Hagedorn <chagedorn@openjdk.org>
  • Roman Kennke <rkennke@openjdk.org>

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30873/head:pull/30873
$ git checkout pull/30873

Update a local copy of the PR:
$ git checkout pull/30873
$ git pull https://git.openjdk.org/jdk.git pull/30873/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30873

View PR using the GUI difftool:
$ git pr show -t 30873

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30873.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Apr 22, 2026

👋 Welcome back roland! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@rwestrel
Copy link
Copy Markdown
Contributor Author

/contributor add chagedorn

@rwestrel
Copy link
Copy Markdown
Contributor Author

/contributor add Luca Ardueser, BSI Software AG

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@rwestrel
Copy link
Copy Markdown
Contributor Author

/contributor add @rkennke

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@rwestrel
Contributor Christian Hagedorn <chagedorn@openjdk.org> successfully added.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@rwestrel Luca Ardueser, BSI Software AG was not found in the census.

Syntax: /contributor (add|remove) [@user | openjdk-user | Full Name <email@address>]. For example:

  • /contributor add @openjdk-bot
  • /contributor add duke
  • /contributor add J. Duke <duke@openjdk.org>

User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@rwestrel
Contributor Roman Kennke <rkennke@openjdk.org> successfully added.

@openjdk openjdk Bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 22, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@rwestrel The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-compiler. This can be overridden with the /reviewers command.

@rwestrel
Copy link
Copy Markdown
Contributor Author

/touch

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@rwestrel The pull request is being re-evaluated and the inactivity timeout has been reset.

@rwestrel rwestrel marked this pull request as ready for review April 22, 2026 14:30
@openjdk openjdk Bot added the rfr Pull request is ready for review label Apr 22, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Apr 22, 2026

Webrevs

Copy link
Copy Markdown
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa-whoa... so if get_alias_index has a side-effect of allocating new index, does that mean that all uses of get_alias_index that are wrapped in DEBUG_ONLY or ASSERT are risky and need to be audited?

Because it is scary if they can breaking release builds without showing up in debug builds. Like this one.

Copy link
Copy Markdown
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the local fix does look good.

@rwestrel
Copy link
Copy Markdown
Contributor Author

Whoa-whoa... so if get_alias_index has a side-effect of allocating new index, does that mean that all uses of get_alias_index that are wrapped in DEBUG_ONLY or ASSERT are risky and need to be audited?

The ones in EA are the risky ones, I think, because we add new indexes there.

if (adr_type != new_adr_type && !init->already_has_narrow_mem_proj_with_adr_type(new_adr_type)) {
DEBUG_ONLY( uint alias_idx = _compile->get_alias_index(new_adr_type); )
// Do NOT remove the next line: ensure a new alias index is allocated for the instance type.
uint alias_idx = _compile->get_alias_index(new_adr_type);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to place alias index probing into NarrowMemProjNode ctor. Or, at least, put an assert there to ensure the index is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

4 participants